package com.zyg.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.zyg.pojo.ClassEx;
import com.zyg.pojo.GradeEx;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClassExMapper extends BaseMapper<ClassEx> {
    @Override
    @Select("select class_id,class_name,grade_id from class ${ew.customSqlSegment}")
    @Results({
            @Result(property = "classId", column = "class_id"),
            @Result(property = "className", column = "class_name"),
            @Result(property = "grade", column = "grade_id", javaType = GradeEx.class,
                    one = @One(select = "com.zyg.dao.GradeExMapper.selectById"))
    })
    List<ClassEx> selectList(IPage<ClassEx> page, @Param(Constants.WRAPPER) Wrapper<ClassEx> queryWrapper);
}
